package behavior.iterator;

public class NameRepository implements Container {

	private String[] nameList = { "AAA", "BBB", "CCC" };

	@Override
	public Iterator getIterator() {

		return new getNameIterator();
	}

	private class getNameIterator implements Iterator {

		int index;

		@Override
		public boolean hasNext() {

			if (index < nameList.length) {
				return true;
			}
			return false;
		}

		@Override
		public Object next() {

			if (this.hasNext()) {
				return nameList[index++];
			}
			return null;

		}

	}

}
